<div class="container-fluid">{{$documents := .documents}}
    <div class="panel panel-default">
        <div class="panel-body">
            <div class="row">
                <form action="/main/search" method="get">
                    <div class="col-md-3">
                        <div class="input-group">
                            <span class="input-group-addon"> 搜索方式</span>
                            <select class="form-control" name="search_type">
                                <option value="title" {{if eq $.search_type "title"}} selected="selected" {{end}}>文档标题</option>
{{/*                                <option value="content" {{if eq $.search_type "content"}} selected="selected" {{end}}>文档内容</option>*/}}
                            </select>
                        </div>
                    </div>
                    <div class="col-md-9">
                        <div class="input-group">
                            <input class="form-control" name="keyword" type="text" value="{{.keyword}}" placeholder="请输入搜索关键字...">
                            <span class="input-group-btn">
				              <button type="submit" class="btn btn-primary"><i class="glyphicon glyphicon-search"></i></button>
				            </span>
                        </div>
                    </div>
                </form>
            </div>
            <hr>
            {{if eq .count 0}}
                <div class="alert alert-info alert-dismissible fade in" role="alert" style="margin-bottom: 0">
                    <p><i class="glyphicon glyphicon-volume-up"></i> 抱歉，暂时没有搜索到您想要的结果</p>
                </div>
            {{else}}
            <div class="row">
                <div class="document-update">
                    <ul>
                    {{range $document := $documents}}
                        <li>
                            <div>
                                <a href="/document/index?document_id={{$document.document_id}}" target="_parent" class="text text-info text-font-15">
                                {{if eq $document.type "1"}}
                                    <i class="fa fa-file-word-o"></i>
                                {{else}}
                                    <i class="fa fa-folder-o"></i>
                                {{end}}
                                {{$document.name}}</a>
                            </div>
                            <span class="text text-font-12 document-user-time"><i class="fa fa-calendar"></i>
                    创建于 {{dateFormat $document.create_time "Y-m-d H:i:s"}}，修改于{{dateFormat $document.update_time "Y-m-d H:i:s"}}
                            </span>
                        </li>
                        <hr>
                        <p class="search-content">{{$document.search_content}}</p>
                    {{end}}
                    </ul>
                </div>
            </div>
            <div class="center">
{{/*            {{template "paginator/default.html" .}}*/}}
            </div>
            {{end}}
        </div>
    </div>
</div>
<script type="text/javascript" src="/static/plugins/mark/mark.min.js"></script>
<script type="text/javascript">
    var keyword = {{.keyword}}
    if (keyword) {
        var searchContent = document.querySelectorAll('.search-content');
        var instance = new Mark(searchContent);
        instance.mark(keyword);
    }
</script>